<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<title>核算项目--客户新增</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/public.css">
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/baseset/moneykind_input.css">
		<script language="JavaScript"
			src="<%=request.getContextPath()%>/js/public.js"></script>
		<script language="JavaScript"
			src="<%=request.getContextPath()%>/js/validate.js"></script>
		<script language="JavaScript"
			src="<%=request.getContextPath()%>/js/date1.js"></script>

		<script type="text/javascript">	
			function validate(){
				var customerCode = document.getElementById("customerCode");
				var customerName = document.getElementById("customerName");
				
				if (!(isNotNull(customerCode,'客户代码')&& f_check_NumOrLett(customerCode,'客户代码')&& f_check_ZhOrNumOrLett(customerCode,'客户代码')&& f_check_NumLength(customerCode,'客户代码')))
					return false;		
				if (!(isNotNull(customerName,'客户名称')&& f_check_ZhOrNumOrLett(customerName,'客户名称')&& f_check_passwordLength(customerName,'客户名称',1,25)))
					return false;
			
			
			   	var phone= document.getElementById("phone");
			   	if(!isNull(phone,'电话号码')){
				  if(!f_check_phone(phone)) return false;
				}
			
			
				var creditNum = document.getElementById("creditNum");
				var increaseTaxPercent = document.getElementById("increaseTaxPercent");
				if (!isNotNull(creditNum,'信用额度'))
				return false;
				if (!f_check_float(creditNum,'信用额度'))
				return false ;
				
				var point=creditNum.split(".");
				if(point.length>=2){
				  alert("信用额度只能精确到小数点后一位");
				  return false;
				}
				if(creditNum.value>1000000){
				  alert("信用额度不能大于一百万");
				  return false;
				}	
				
				if (!isNotNull(increaseTaxPercent,'增值税率'))
				return false;
				if (!f_check_number(increaseTaxPercent,'增值税率'))
				return false;
				if(increaseTaxPercent.value>1000){
				 alert("输入的数据应该小于1000");
				 return false;
				}
				
			
				var post=document.getElementById("post");
				if(!isNull(post,'邮政编码')){
				  if(!f_check_zipcode(post)) return false;
				}
				
				var mailAddress=document.getElementById("mailAddress");
				 if(!isNull(mailAddress,'电子邮件')){
				   if(!f_check_email(mailAddress)) return false;
				 }	   
			}
		</script>
	</head>

	<body>
		<div id="info_all" style="width: 510px;">
			<div id="info_top">
				核算项目--客户新增
			</div>
			<div style="width: 500px; margin-top: 6px;">
				<s:form action="addCustomer.action" method="post"
					theme="simple" onsubmit="return validate()">
					<table
						style="margin-top: 10px; background: #fbfbfb; color: #403040;"
						align="center">
						<tr>
							<td width="60px">
								代码(*)：
							</td>
							<td>
								<s:hidden name="cdto.customer.customerId" id="customerId"></s:hidden>
								<s:textfield name="cdto.customer.customerCode" id="customerCode"
									size="12" maxlength="12"></s:textfield>
							</td>
							<td>
								信用额度(*)：
							</td>
							<td>
								<s:textfield name="cdto.customer.creditNum" id="creditNum"
									size="12"  maxlength="8"></s:textfield>(小数前2位)
							</td>
						</tr>
						<tr>
							<td>
								名称(*)：
							</td>
							<td>
								<s:textfield name="cdto.customer.customerName" id="customerName"
									size="12" maxlength="12"></s:textfield>
							</td>
							<td>
								销售方式：
							</td>
							<td>
									<s:select
										list="#{'0':'','1':'现销','2':'赊销','3':'分期收款销售','4':'委托代销'}"
										name="cdto.customer.salesMethod" cssStyle="width:110px;">
									</s:select>
							</td>
						</tr>
						<tr>
							<td width="60px">
								客户简称：
							</td>
							<td>
								<s:textfield name="cdto.customer.customerBrief"
									id="customerBrief" size="12" maxlength="12"></s:textfield>
							</td>
							<td>
								联系人：
							</td>
							<td>
								<s:textfield name="cdto.customer.linkman" id="linkman" size="12" maxlength="10"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								地址：
							</td>
							<td>
								<s:textfield name="cdto.customer.address" id="address" size="12" maxlength="20"></s:textfield>
							</td>
							<td>
								邮件地址：
							</td>
							<td>
								<s:textfield name="cdto.customer.mailAddress" id="mailAddress"
									size="12" maxlength="50"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								区域：
							</td>
							<td>
								<s:hidden name="cdto.customer.PBaseAssistantmaterialAreaId"
									id="areaId"></s:hidden>
								<s:textfield name="cdto.area.areaName" id="areaName" size="12"
									readonly="true"></s:textfield>
								<img src="images/kookup.gif" style="cursor: pointer"
									onclick="openWin('selectArea.action','area',350,500,0)">
							</td>
							<td>
								税务登记号：
							</td>
							<td>
								<s:textfield name="cdto.customer.taxRegisterNo"
									id="taxRegisterNo" size="12" maxlength="15"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								行业：
							</td>
							<td>
								<s:hidden name="cdto.customer.PBaseAssistantmaterialIndustryId"
									id="industryId"></s:hidden>
								<s:textfield name="cdto.industry.industryName" id="industryName"
									readonly="true" size="12"></s:textfield>
								<img src="images/kookup.gif" style="cursor: pointer"
									onclick="openWin('selectIndustry.action','industry',340,500,0)" >

							</td>
							<td>
								开户银行：
							</td>
							<td>
								<s:textfield name="cdto.customer.openAccountBank"
									id="openAccountBank" size="12" maxlength="15"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								电话：
							</td>
							<td>
								<s:textfield name="cdto.customer.phone" id="phone" size="12" maxlength="13"></s:textfield>
							</td>
							<td>
								银行账号：
							</td>
							<td>
								<s:textfield name="cdto.customer.bankAccount" id="bankAccount"
									size="12" maxlength="15"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								传真：
							</td>
							<td>
								<s:textfield name="cdto.customer.fax" id="fax" size="12" maxlength="15"></s:textfield>
							</td>
							<td width="120px">
								增值税率(%)(*)：
							</td>
							<td>
								<s:textfield name="cdto.customer.increaseTaxPercent"
									id="increaseTaxPercent" size="12" maxlength="12" value="17"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								邮编：
							</td>
							<td>
								<s:textfield name="cdto.customer.post" id="post" size="12" maxlength="6"></s:textfield>
							</td>
							<td>
								主页：
							</td>
							<td>
								<s:textfield name="cdto.customer.webSite" id="webSite" size="12" maxlength="20"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								城市：
							</td>
							<td>
								<s:textfield name="cdto.customer.city" id="city" size="12" maxlength="12" maxlength="12"></s:textfield>
							</td>
							<td>
								法人代表：
							</td>
							<td>
								<s:textfield name="cdto.customer.responsibleMan"
									id="responsibleMan" size="12" maxlength="15"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								省份：
							</td>
							<td>
								<s:textfield name="cdto.customer.province" id="province"
									size="12" maxlength="12"></s:textfield>
							</td>
							<td>
								客户分类：
							</td>
							<td>
								<s:hidden
									name="cdto.customer.PBaseAssistantmaterialCustomercategoryId"
									id="customerTypeId"></s:hidden>
								<s:textfield name="cdto.customerCategory.customerCategoryName"
									readonly="true" id="customerTypeName" size="12" maxlength="12"></s:textfield>
								<img src="images/kookup.gif" style="cursor: pointer"
									onclick="openWin('selectCustomerType.action','customerCategoryId',750,700,0)">
							</td>
						</tr>
						<tr>
							<td>
								国家：
							</td>
							<td>
								<s:textfield name="cdto.customer.country" id="country" size="12" maxlength="12"></s:textfield>
							</td>
							<td>
								分管部门：
							</td>
							<td>
								<s:hidden name="cdto.customer.PBaseVerifyprojectDepartmentId"
									id="departmentId"></s:hidden>
								<s:textfield name="cdto.department.departmentName"
									readonly="true" id="departmentName" size="12"></s:textfield>
								<img src="images/kookup.gif" style="cursor: pointer"
									onclick="openWin('selectDepartment.action','department',970,500,1)">
								&nbsp;&nbsp;&nbsp;
							</td>
						</tr>
						<tr>
							<td width="60px">
								结算期限：
							</td>
							<td>
								<s:hidden
									name="cdto.customer.PBaseAssistantmaterialBalancedeadlineId"
									id="deadlineId"></s:hidden>
								<s:textfield name="cdto.balancedeadline.balanceDeadLineName"
									readonly="true" id="deadlineName" size="12"></s:textfield>
								<img src="images/kookup.gif" style="cursor: pointer"
									onclick="openWin('selectDeadline.action','deadlineId',750,700,0)">
							</td>
							<td>
								专营业务员：
							</td>
							<td>
								<s:hidden name="cdto.customer.PBaseVerifyprojectCandiateId"
									id="candiateId"></s:hidden>
								<s:textfield name="cdto.candiate.candiateName" readonly="true"
									id="candiateName" size="12"></s:textfield>
								<img src="images/kookup.gif" style="cursor: pointer"
									onclick="openWin('selectCandiate.action','candiate',1050,700,0)">
							</td>
						</tr>
					</table>
					<center>
							<div id="accountbtm_btn">
								<input type="submit" value="保存" onFocus="this.blur()"
									onmouseover="this.className='btnover'"
									onmouseout="this.className='btnout'" class="btnsize"/>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<input type="button" value="返回" onFocus="this.blur()"
									onmouseover="this.className='btnover'"
									onmouseout="this.className='btnout'" class="btnsize" onclick="javascript:history.back()"/>
							</div>
				<center>
				</s:form>
			</div>
		</div>
	</body>
</html>
